//商品相关方法

const {
    execSQL
} = require('../db/mysql')

//商品数据
const getGoodDetail = ({
    id
}) => {
    let sql = `select itemInfo,shopInfo,columns,detailInfo,itemParams,rate from detail where id = '${id}'`;
    return execSQL(sql).then((res) => {
        let result = {
            itemInfo:JSON.parse(res[0]['itemInfo']),
            shopInfo:JSON.parse(res[0]['shopInfo']),
            columns:JSON.parse(res[0]['columns']),
            detailInfo:JSON.parse(res[0]['detailInfo']),
            itemParams:JSON.parse(res[0]['itemParams']),
            rate:JSON.parse(res[0]['rate']),
        };
        return result;
    }).catch(e => {
        return false;
    })
}






module.exports = {
    getGoodDetail,
}